<?php
    session_start();

    include 'function.php';
    display_header();
    $nom = ($_POST['nom']);
    $prenom = ($_POST['prenom']);
    $mail = ($_POST['mail']);
    $login = ($_POST['login']);
    $mdp = ($_POST['mdp']);
    
     if(($nom == '') || $prenom == '' || !(filter_var($mail, FILTER_VALIDATE_EMAIL)) || $login || $mdp)
    {
        include 'include/Data.php';
        $sql = "INSERT INTO utilisateur (NumUtilisateur,prenom,nom,Login,Password,Email,Autorisation) VALUES (' ','".$prenom."','".$nom."','".$login."','".$mdp."','".$mail."',1)";
        $req = mysql_query($sql,$connexion);
        
       $pseudo = $_POST['login'];
       $mdp = $_POST['mdp'];
    }
    else 
    {   
        echo '
            <form method="post" action="login.php" >
            <table>
                <input type="text" value="<?php echo $pseudo ; ?>" style="display:none" name="login">
                <input type="text" value="<?php echo $mdp ; ?>" style="display:none" name="mdp">
            </table>
            <input type="submit" value="Redirection vers le site">
            </form>';
     
     } 
     header("Refresh: 0; URL=index.php");
    display_footer();
    is_log();
?>